/*
 * @lc app=leetcode.cn id=1323 lang=typescript
 *
 * [1323] 6 和 9 组成的最大数字
 */

// @lc code=start
function maximum69Number(num: number): number {
    let it = "";
    let once = true;
    for (const iterator of num.toString()) {
        if (once && iterator === "6") {
            it += "9";
            once = false;
            continue;
        }
        it += iterator;
    }
    return parseInt(it);
}
// @lc code=end
